<template>
	<view class="p30">
		<view class="p30 bg-fff radius10">
			<u-parse :html="html" :domain="$baseUrl" :lazy-load="true"></u-parse>
			<!-- <view class="" v-html="html"></view> -->
		</view>
	</view>
</template>

<script>
	// @click="$jump('/pages/public/text',{text:'user',tit:'用户协议'})"
	export default {
		data() {
			return {
				data: {
					detail: ''
				},
				params: '',
			};
		},
		computed: {
			html() {
				let data = this.data
				let aa = data.detail || data.content || this.$config[this.params.text] || ''
				return aa
			}
		},
		onLoad(e) {
			this.params = e
			this.getData()
			if (e.tit || e.title) {
				uni.setNavigationBarTitle({
					title: e.tit || e.title
				})
			}
			// #ifdef H5

			setTimeout(() => {
				if (e.type) document.getElementsByClassName('uni-page-head-hd')[0].style.display = 'none'
			}, 0)
			// #endif
		},
		methods: {
			getData() {
				if (this.params.text) {
					this.$getConfig()
				} else if (this.params.api) {
					this.$request(this.params.api, this.params).then(res => {
						this.data = res.data
					})
				} else if (this.params.detail == 'richText') { //缓存中取
					this.data.detail = this.$getData('richText')
				}
			}
		}
	}
</script>

<style lang="scss">

</style>